package com.datawale.vh.demo.work.service;

import com.datawale.vh.demo.work.domain.Avatar;
import com.datawale.vh.demo.work.mapper.AvatarMapper;
import com.datawale.vh.demo.work.query.AvatarQuery;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author huangtao
 * @time 2023/6/8
 * @description
 */
@Service
public class AvatarService {

    @Autowired
    private AvatarMapper avatarMapper;

    public Avatar selectOne(){
        AvatarQuery query = AvatarQuery.builder().env("dev").build();
        return avatarMapper.selectOne(query);
    }

    public List<Avatar> selectAll(){
        AvatarQuery query = AvatarQuery.builder().env("dev").build();
        return avatarMapper.selectAll(query);
    }

    public int update(Avatar avatar){
        int i = avatarMapper.update(avatar);
        return i;
    }

    public Long insert(Avatar avatar){
        Long id = avatarMapper.insert(avatar);
        return id;
    }

    public Long count(AvatarQuery query){
        AvatarQuery avatarQuery = AvatarQuery.builder().env("dev").build();
        return avatarMapper.count(avatarQuery);
    }
}
